<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>计价系统</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap-theme.min.css">

<style type="text/css">
	body{
	margin: 0px;
	padding: 0px;
	padding-top:70px;
	}
	
	#xuanfudiv {
		position: absolute;
		top:10px;
	}
	
	#xuanul {
		list-style: none;
		display: block;
		width: 200px;
		position: relative;
		top: 100px;
		left: 0px;
		padding: 60px 0 60px 0;
		background: url(images/shad2.png) no-repeat;
		-webkit-background-size: 50% 100%;
	}
	#xuanul li {
		margin: 5px 0 0 0;
	}
	
	#xuanul  li a {
		-webkit-transition: all 0.3s ease-out;
		background: #cbcbcb url(images/border.png) no-repeat;
		color: #174867;
		padding: 7px 15px 7px 15px;
		-webkit-border-top-right-radius: 10px;
	 	-webkit-border-bottom-right-radius: 10px;
		width: 100px;
		display: block;
		text-decoration: none;
		-webkit-box-shadow: 2px 2px 4px #888;
	}
	
	#xuanul  li a:hover {
		background: #ebebeb url(images/border.png) no-repeat;
		color: #67a5cd;
		padding: 7px 15px 7px 30px;
	}
	
</style>

</head>
<body>
	<nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">螃蟹计价系统</a>
        </div>
        
        <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      
	      <ul class="nav navbar-nav">
	        <li><a href="${ pageContext.request.contextPath }/index.jsp">首页<span class="caret"></span> </a></li>
	        
	        <li class="dropdown active">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单创建 <span class="sr-only">(current)</span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=0">出货清单</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">今日汇总 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=0">出货清单</a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByDate.do">规格比较</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单查询 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=0">出货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByTimeUI.do">规格查询</a></li>
	          </ul>
	        </li>
	        
	      </ul>
	     
	      <ul class="nav navbar-nav navbar-right">	
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/user_updateUI.do?userid=1">修改用户</a></li>
	          </ul>
	        </li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
       
      </div>
   </nav>
  
  <s:if test="null != #tempList && !#tempList.isEmpty()">
	 <div id="xuanfudiv">
		<ul id="xuanul">
			<s:iterator value="tempList">
				<li><a href="temp_show.do?id=${id }&isOrder=<s:property value='#isOrder'/>">${clientName }</a></li>
			</s:iterator>
			<s:if test="#tempList.size < 5">
				<li><a href="#">空白</a></li>
				<li><a href="#">空白</a></li>
				<li><a href="#">空白</a></li>
			</s:if>
		</ul>
	</div>
</s:if>
	
	<div class="container">
		<div class="row-fluid">
			<div class="span12">
				<h3 class="text-center">
					<s:property value="#title" />
				</h3>
				<br>
				<br>
				
				<s:form id="createform" method="post">
				<input type="hidden" name="userid" value="1"/>
				<input type="hidden" name="isOrder" value="<s:property value='#isOrder'/>"/>
				<div class="row clearfix">
					<div class="col-md-2 column">
						<div class="form-group">
			    			<label for="username" class="control-label">客户</label>
			      			<input type="text" class="form-control" id="name" name="name" value="<s:property value='#name' />">
			    		</div>
		    		</div>
		    		
		    		<div class="col-md-8 column">
						
		    		</div>
		    		
		    		<div class="col-md-2 column">
						日期：${date }
		    		</div>
	    		</div>
	    		
	    		<div class="row clearfix">
		    		<div class="col-md-6 column">
						<table class="table table-bordered">
							<caption class="text-center">
									公蟹
							</caption>
							<thead>
								<tr>
									<th>
										规格
									</th>
									<th>
										数量
									</th>
									<th>
										单价
									</th>
									<th>
										备注
									</th>
								</tr>
							</thead>
							<tbody>
							<s:iterator value="crabList">
								<s:if test="ismale == 1">
									<input type="hidden" name="malecrabids" value="${id}"/>
								<tr>
									<td>
										${name}
									</td>
									<td>
							      		<input type="text"  class ="mount" name ="malemounts" value ="${number }" size=10>
									</td>
									<td>
										<input type="text" name="malecrabPrice" value="${crabPrice.price }" size=10/>
									</td>
									<td>
										<input type="text"  name ="maledescribes" value ="${note } " size=20>
									</td>
								</tr>
								</s:if>
								</s:iterator>
							</tbody>
						</table>
					 </div>
					
					 <div class="col-md-6 column">
						<table class="table table-bordered">
							<caption class="text-center">
									母蟹
							</caption>
							<thead>
								<tr>
									<th>
										规格
									</th>
									<th>
										数量
									</th>
									<th>
										单价
									</th>
									<th>
										备注
									</th>
								</tr>
							</thead>
							<tbody>
							<s:iterator value="crabList">
								<s:if test="ismale == 0">
									<input type="hidden" name="femalecrabids" value="${id}"/>
								<tr>
									<td>
										${name}
									</td>
									<td>
							      		<input type="text"  class ="mount" name ="femalemounts" value="${number }" size=10>
									</td>
									<td>
										<input type="text" name="femalecrabPrice" value="${crabPrice.price }" size=10/>
									</td>
									<td>
										<input type="text"  name ="femaledescribes" value="${note }" size=20>
									</td>
								</tr>
								</s:if>
								</s:iterator>
							</tbody>
						</table>
					 </div>
					
				 </div>
				 
				 <div class="row clearfix">
				 	<div class="col-md-4 column"></div>
				 	
				 	<div class="col-md-4 column">
				 		<input class="btn  btn-primary" type="button" id="computebtn" value="进行计算"/>
				 		<input class="btn  btn-primary" type="button" id="tempbtn" value="暂时挂起"/>
						<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">修改价格</button>
					 </div>
					 
					<div class="col-md-4 column"></div>
				</div>
				</s:form>
				
				<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
					<div class="modal-dialog modal-lg">
						<div class="modal-content">
					     	<div class="row clearfix">
				    			<h3 class="text-center">
									螃蟹价格修改
								</h3>
								<s:form action="price_update" method="post">
								<input type="hidden" name="isOrder" value="<s:property value='#isOrder'/>"/>
					    		<div class="col-md-6 column">
									<table class="table table-bordered">
										<caption class="text-center">
												公蟹
										</caption>
										<thead>
											<tr>
												<th>
													规格
												</th>
												
												<th>
													单价
												</th>
												
											</tr>
										</thead>
										<tbody>
										<s:iterator value="crabList">
											<s:if test="ismale == 1">
												<input type="hidden" name="malecrabids" value="${id}"/>
											<tr>
												<td>
													${name}
												</td>
												<td>
													<input type="text"  class="price" class="price" name= "maleprices" value="${crabPrice.price } ">
												</td>
											</tr>
											</s:if>
											</s:iterator>
										</tbody>
									</table>
									 </div>
									
									 <div class="col-md-6 column">
										<table class="table table-bordered">
											<caption class="text-center">
													母蟹
											</caption>
											<thead>
												<tr>
													<th>
														规格
													</th>
													
													<th>
														单价
													</th>
													
												</tr>
											</thead>
											<tbody>
											<s:iterator value="crabList">
											<s:if test="ismale == 0">
												<input type="hidden" name="femalecrabids" value="${id}"/>
												<tr>
													<td>
														${name}
													</td>
													<td>
														<input type="text"  class="price" name= "femaleprices" value="${crabPrice.price }">
													</td>
												</tr>
												</s:if>
												</s:iterator>
											</tbody>
										</table>
								 	</div>
									<div class="col-md-5 column"></div>
						 	
						 			<div class="col-md-2 column">
						 				<input type="submit" class="btn  btn-primary" id="updatebtn" value="确认修改"/>
							 		</div>
									<div class="col-md-5 column"></div>
								</s:form>
						 </div>
						 
					    </div>
					 </div>
				</div>
				
			</div>
		</div>
	</div>
	
</body>
</html>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${ pageContext.request.contextPath }/js/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${ pageContext.request.contextPath }/js/bootstrap.min.js"></script>

<script type="text/javascript">
	$(function () {
		$("#computebtn").click(function(){
			$("#createform").attr("action","order_create.do");
			var username = $("#name").val().trim();
			if(username == ""){
				alert("客户姓名不能为空！");
				$("#username").focus();
			}else{
				$("#createform").submit();
			}
		});
	});
	
	$("#tempbtn").click(function(){
		$("#createform").attr("action","temp_create.do");
		var username = $("#name").val().trim();
		if(username == ""){
			alert("客户姓名不能为空！");
			$("#username").focus();
		}else{
			$("#createform").submit();
		}
	});
	
</script>

<script type="text/javascript">
	$(function () {
		$("#name").blur(function(e){
			var username = $("#name").val();
			if(username == ""){
				alert("客户姓名不能为空！");
				$("#username").focus();
			}
		});
		
		$(".price").blur(function(){
			var price = $(this).val().trim();
			if(price != null && price !=""){
				if(isNaN(price)){
					alert("请输入数字");
					$(".price").focus();
				}
			}
		});
    
		$(".mount").blur(function(){
			var mount = $(this).val().trim();
			if(mount != null && mount !=""){
				if(isNaN(mount)){
					alert("请输入数字");
					$(".mount").focus();
				}
			}
		});
		
	});
 </script>